import request from "@/utils/request.ts"
import type { PageModelResult } from '@/api/model/pageParam.ts'
import type { ResultModel } from '@/api/model/ResultModel.ts';
import type { userChargeModel } from '@/api/model/userCharge.ts'
import type { commonStatus } from '@/api/model/CommonStatus.ts'

// 条件分页查询
export const queryUsersListApi = (username : string, status : string, page : number, pageSize : number) =>
	request.get<any, PageModelResult>(`/userCharge?username=${username}&status=${status}&page=${page}&pageSize=${pageSize}`)


// 新增用户
export const addUserApi = (users : userChargeModel) => request.post<any, ResultModel>('/userCharge', users)

// 编辑用户(步骤一：回显)
export const getByIdUserApi = (id : number) => request.get<any, ResultModel>(`/userCharge/${id}`)


// 编辑用户(步骤二：更新用户信息)
export const updateUserApi = (users : userChargeModel) => request.put<any, ResultModel>('/userCharge', users)


// 删除用户（批量删除）
export const deleteUserApi = (ids : string) => request.delete<any, ResultModel>(`/userCharge?ids=${ids}`)

// 修改用户状态（批量）

export const disableUserApi = (userStatus : commonStatus) => request.put<any, ResultModel>('/userCharge/status', userStatus)